using UnityEngine;
using Noise;
using System;
using Render;

public class LookUpTexture : GUITextureNode
{
    public enum Type
    {
        Permutation,
        Gradient
    }

    public Type TextureType;

    protected override Texture2D CreateTexture()
    {
        return Textures.Create2D(GetPixelData(), TextureSize, false, true, 0, FilterMode.Point, TextureWrapMode.Repeat);
    }

    private uint[] GetPixelData()
    {
        switch (TextureType)
        {
        case Type.Permutation:  return PermutationArray.Perm2(TextureSize, TextureSize);
        case Type.Gradient:     return GradientArray.Grad2(TextureSize, TextureSize);
        default:                throw new Exception();
        }
    }
}